<template>
	<div class="page">
		<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pagenum"
			:page-sizes="[3, 6, 9, 30]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper"
			:total="total"></el-pagination>
	</div>
</template>

<script>
export default {
	name: 'Pagination',
	props: ['total'],
	data() {
		return {
			// total: 0,
			pagenum: 1,
			pagesize: 9
		};
	},
	methods: {
		// 分页
		handleSizeChange(val) {
			console.log(`每页 ${val} 条`);
			this.pagesize = val;
			// this.getListFn();
			this.$emit('pagination', { pagenum: 1, pagesize: val });
		},
		handleCurrentChange(val) {
			console.log(`当前页: ${val}`);
			this.pagenum = val;
			// this.getListFn();
			this.$emit('pagination', { pagenum: val, pagesize: this.pagesize });
		}
	}
};
</script>

<style></style>
